﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class ListCustomerNameDetail : NotifyPropertyChangeObject
    {
        private int customerModelID;
        
        private string reference;
        private string description;
        private string other;

        private bool inActive;


        public ListCustomerNameDetail()
            : this(0, "", "", "", false )
        {
        }

        public ListCustomerNameDetail(int customerModelID, string reference, string description, string other, bool inActive)
        {
            GlobalDefaultValue.Apply(this);

            this.CustomerModelID = customerModelID;
            this.Reference = reference;
            this.Description = description;
            this.Other = other;
            this.InActive = inActive;
            
        }


        #region Properties

        [DefaultValue(0)]
        public int CustomerModelID
        {
            get { return this.customerModelID; }
            set { ApplyPropertyChange<ListCustomerNameDetail, int>(ref this.customerModelID, o => o.CustomerModelID, value); }
        }


        [DefaultValue("")]
        public string Reference
        {
            get { return this.reference; }
            set { ApplyPropertyChange<ListCustomerNameDetail, string>(ref this.reference, o => o.Reference, value); }
        }

        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListCustomerNameDetail, string>(ref this.description, o => o.Description, value); }
        }

        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<ListCustomerNameDetail, string>(ref this.other, o => o.Other, value); }
        }

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<ListCustomerNameDetail, bool>(ref this.inActive, o => o.InActive, value); }
        }

        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("CustomerModelID", "Please fill a common ID.", delegate { return (this.CustomerModelID > 0); }));
            validationRules.Add(new SimpleValidationRule("Reference", "Please fill a common value.", delegate { return (!string.IsNullOrWhiteSpace(this.Reference)); }));

            return validationRules;
        }
    }
}
